|
|
|
|
|
|
|
End If
'
strSearch = InputBox("Enter Search Value:", "Searching " & FieldName)
strSearch = Trim(strSearch)
'
If strSearch = "" Then
RSLocate = False
Exit Function
End If
'
If rs.Fields(FieldName).Type = dbText Then
strSearch = "'" & strSearch & "'"
End If
'
If blnIndex = True Then
rs.Seek "=", strSearch
Else
rs.FindFirst FieldName & "=" & strSearch
End If
'
If rs.NoMatch = True Then
RSLocate = False
Else
RSLocate = True
End If
'
Exit Function
'
LocalErr:
RSLocate = Err.Number
'
End Function |
|
|
|
|
|
|
|
|
Notice that if you set the IndexFlag property to True in this routine, the routine uses the Seek method instead of a sequential Find method. Also note the check for a text-type search field. If the target field to search has a dbText data type, the search values are enclosed in single quotes. |
|
|
|
|
|
|
|
|
Now you get one of the important routines! The RSRead routine takes values from the current record of the dataset and loads them into controls on the form. This is done by checking all the controls on the form for a nonblank Tag property. If a control has a value in the Tag property, the routine assumes that the value is a column name for the dataset. The value in this column is then copied from the dataset into the form control. Add this new routine (shown in Listing 10.12) to your library. Note that this routine is built as a Private Function. You do not want external programs to be able to invoke this function directly. |
|
|
|
|
|